<?php

/**
 * BeamrSlide form base class.
 *
 * @package    form
 * @subpackage beamr_slide
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseBeamrSlideForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'presentation_id'  => new sfWidgetFormDoctrineChoice(array('model' => 'BeamrPresentation', 'add_empty' => false)),
      'title'            => new sfWidgetFormInput(),
      'subtitle'         => new sfWidgetFormInput(),
      'content'          => new sfWidgetFormTextarea(),
      'is_plain'         => new sfWidgetFormInputCheckbox(),
      'created_at'       => new sfWidgetFormDateTime(),
      'updated_at'       => new sfWidgetFormDateTime(),
      'thumbnail'        => new sfWidgetFormInput(),
      'token'            => new sfWidgetFormInput(),
      'weight'           => new sfWidgetFormInput(),
      'section'          => new sfWidgetFormInput(),
      'section_short'    => new sfWidgetFormInput(),
      'subsection'       => new sfWidgetFormInput(),
      'subsection_short' => new sfWidgetFormInput(),
      'section_in_toc'   => new sfWidgetFormInputCheckbox(),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorDoctrineChoice(array('model' => 'BeamrSlide', 'column' => 'id', 'required' => false)),
      'presentation_id'  => new sfValidatorDoctrineChoice(array('model' => 'BeamrPresentation')),
      'title'            => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'subtitle'         => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'content'          => new sfValidatorString(array('max_length' => 8000, 'required' => false)),
      'is_plain'         => new sfValidatorBoolean(),
      'created_at'       => new sfValidatorDateTime(array('required' => false)),
      'updated_at'       => new sfValidatorDateTime(array('required' => false)),
      'thumbnail'        => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'token'            => new sfValidatorString(array('max_length' => 255)),
      'weight'           => new sfValidatorInteger(),
      'section'          => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'section_short'    => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'subsection'       => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'subsection_short' => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'section_in_toc'   => new sfValidatorBoolean(),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorDoctrineUnique(array('model' => 'BeamrSlide', 'column' => array('token')))
    );

    $this->widgetSchema->setNameFormat('beamr_slide[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'BeamrSlide';
  }

}